#include "ros/ros.h"
#include "std_msgs/String.h"
#include <sstream>
#include "./data_parse.cpp"


int main(int argc, char **argv)
{
   ros::init(argc, argv, "listener"); //the name of node
   ros::NodeHandle n,n_para("~");
   buu_ctrller::Ctrller my_ctrller;
   ros::Subscriber sub_path,sub_stat;
   sub_path = n.subscribe("/com/path", 1000, &buu_ctrller::Ctrller::callbackPath,&my_ctrller);
   sub_stat = n.subscribe("/com/veh_stat",1000,&buu_ctrller::Ctrller::callbackVehStat,&my_ctrller);
   

   ros::Publisher pub = n.advertise<std_msgs::String>("/com/serial",1);

   ros::Rate loop_rate(1);
   while(ros::ok())
   {
       ros::spinOnce();
       std_msgs::String cmd;
       my_ctrller.ctrl(cmd);
//ROS_INFO("I heard: [%s]", cmd);
       pub.publish(cmd);
       loop_rate.sleep();
   }
   
   return 0;
}
